|
|
@@ -22,7 +22,8 @@ gem_package("rake")
|
22
|
22
|
gem_package("bundle")
|
23
|
23
|
|
24
|
24
|
service "nginx" do
|
25
|
|
- action :start
|
|
25
|
+ supports :restart => true, :start => true, :stop => true, :reload => true
|
|
26
|
+ action :nothing
|
26
|
27
|
end
|
27
|
28
|
|
28
|
29
|
bash "Setting huginn user with NOPASSWD option" do
|
|
|
@@ -36,26 +37,26 @@ end
|
36
|
37
|
deploy "/home/huginn" do
|
37
|
38
|
repo "https://github.com/cantino/huginn.git"
|
38
|
39
|
user "huginn"
|
|
40
|
+ group "huginn"
|
39
|
41
|
environment "RAILS_ENV" => "production"
|
40
|
42
|
keep_releases 5
|
41
|
43
|
create_dirs_before_symlink []
|
42
|
44
|
symlinks "log" => "log"
|
43
|
45
|
symlink_before_migrate({})
|
44
|
46
|
rollback_on_error true
|
|
47
|
+ notifies :enable, "service[nginx]"
|
|
48
|
+ notifies :start, "service[nginx]"
|
45
|
49
|
before_symlink do
|
46
|
50
|
%w(config log tmp).each do |dir|
|
47
|
51
|
directory "/home/huginn/shared/#{dir}" do
|
48
|
52
|
owner "huginn"
|
|
53
|
+ group "huginn"
|
49
|
54
|
recursive true
|
50
|
55
|
end
|
51
|
56
|
end
|
52
|
57
|
directory("/home/huginn/shared/tmp/pids")
|
53
|
58
|
directory("/home/huginn/shared/tmp/sockets")
|
54
|
|
- cookbook_file "/etc/nginx/nginx.conf" do
|
55
|
|
- source "nginx.conf"
|
56
|
|
- owner "huginn"
|
57
|
|
- end
|
58
|
|
- %w(Procfile unicorn.rb Gemfile).each do |file|
|
|
59
|
+ %w(Procfile unicorn.rb Gemfile nginx.conf).each do |file|
|
59
|
60
|
cookbook_file "/home/huginn/shared/config/#{file}" do
|
60
|
61
|
owner "huginn"
|
61
|
62
|
action :create_if_missing
|
|
|
@@ -72,6 +73,7 @@ deploy "/home/huginn" do
|
72
|
73
|
bash "huginn dependencies" do
|
73
|
74
|
cwd "/home/huginn/current"
|
74
|
75
|
user "huginn"
|
|
76
|
+ group "huginn"
|
75
|
77
|
code <<-EOH
|
76
|
78
|
export LANG="en_US.UTF-8"
|
77
|
79
|
export LC_ALL="en_US.UTF-8"
|
|
|
@@ -79,6 +81,7 @@ deploy "/home/huginn" do
|
79
|
81
|
ln -nfs /home/huginn/shared/config/Procfile ./Procfile
|
80
|
82
|
ln -nfs /home/huginn/shared/config/.env ./.env
|
81
|
83
|
ln -nfs /home/huginn/shared/config/unicorn.rb ./config/unicorn.rb
|
|
84
|
+ sudo cp /home/huginn/shared/config/nginx.conf /etc/nginx/
|
82
|
85
|
sudo bundle install
|
83
|
86
|
sed -i s/REPLACE_ME_NOW\!/$(sudo rake secret)/ .env
|
84
|
87
|
sudo rake db:create
|